<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <ul>
      <li v-for="item in list.data">
        <router-link v-bind="{to:'/detail/'+item.id}">
          <p>{{item.name}}</p>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: 'HelloWorld',
    data() {
      return {
        msg: '巴哥',
        list: {
          "data": [{            //对象中嵌套数组，数组是返回的数据，
            "id": 1,
            "name": "xiaohong"
          }, {
            "id": 2,
            "name": "xiaoming"
          }]
        }
      }
    }
  }
</script>
<style scoped>
  h1, h2 {
    font-weight: normal;
  }

  ul {
    list-style-type: none;
    padding: 0;
  }

  li {
    display: inline-block;
    margin: 0 10px;
  }

  a {
    color: #42b983;
  }
</style>
